package com.k.kpp;


import com.k.kc.util.ReflectUtl;

import java.lang.reflect.InvocationTargetException;

public class UserReflectTest {
    private static void test(){
        Object[] valueArr = new Object[]{
                "jim","123",123,22
        };
        try {
            User u = ReflectUtl.setValueByField(User.class,valueArr);
            User u2 = ReflectUtl.setValueByMethod(User.class,valueArr);
            System.out.println("username:"+u.getUsername()+" password:"+u.getPassword()+" age:"+u.getAge()+" type:"+u.getType());
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
    private static void test2(){
        for(int i=100;i<1000;i++){
            for(int j=1;j<10;j++){
                if(i%j==7){
                    System.out.println("i:"+i+"%"+j+"=7");
                }
            }
        }
    }
    public static void main(String[] args) {
        test();
    }
}
